package ds.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class GeneralApp {

	public static String getString() throws IOException
	{
		// ----- 这两个经常一起用哈 -----
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		
		String s = br.readLine();
		return s;
		// return new BufferedReader(new InputStreamReader(System.in)).readLine();
	}
	
	public static int getInt() throws IOException
	{
		// return new DataInputStream(System.in).readInt(); 错的
		String s = getString();
		return Integer.parseInt(s);
	}
	
	public static char getChar() throws IOException
	{
		// return new DataInputStream(System.in).readChar(); 错的
		String s = getString();
		return s.charAt(0);
	}
	
	public static int[] randomArray(int length, int range) {
		int[] a = new int[length];

		/*
		 * Random rand = new Random(); for (int i=0;i<a.length;i++) {
		 * a[i]=rand.nextInt(range); }
		 */

		for (int i = 0; i < a.length; i++) {
			a[i] = (int) (Math.random() * range);
		}

		return a;
	}
	
	public static void printArray(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i] + " ");
		}
		System.out.println();
	}
}
